#include<iostream>
#include<thread>
#include<condition_variable>
#include<mutex>
using namespace std;
int main()
{
	mutex mux;
	int n = 1;
	condition_variable cv;

	thread n1([&]()
		{
			while (n < 100)
			{
				unique_lock<mutex>st(mux);
				if (n % 2 == 0)
				{
					cv.wait(st);
				}
				cout << "threadn1:" << n << endl;
				n++;
				cv.notify_one();
			}
		});
	thread n2([&]()
		{
			while (n < 100)
			{
				unique_lock<mutex>st(mux);
				if (n % 2 != 0)
				{
					cv.wait(st);
				}
				cout << "threadn2:" << n << endl;
				n++;
				cv.notify_one();
			}
		});

	n1.join();
	n2.join();



}